class Solution {
    public int removeDuplicates(int[] nums) {
        if(nums == null || nums.length == 0) {
            return 0;
        }
        int qian = 0;
        int huo = 1;
        while(huo <nums.length) {
            if(nums[qian] != nums[huo]) {
                nums[qian+1] = nums[huo];
                qian++;
            }
            huo++;
        }
        return qian+1;//下标从0开始，所以+1
    }
}